Skip to content

Add tests for math (#31)#32

Merged
not522 merged 9 commits into
not522:masterfrom
KATO-Hiro:features/test_math
Dec 12, 2020
Merged

Add tests for math (#31)#32
not522 merged 9 commits into
not522:masterfrom
KATO-Hiro:features/test_math

Conversation

@KATO-Hiro

@KATO-Hiro KATO-Hiro commented Sep 23, 2020

Copy link
Copy Markdown
Contributor

@not522 さん

WHAT

  • math.pyおよび_math.pyのテストを追加しました。
    • 公式リポジトリおよび他言語への移植プロジェクトを参考に、正常系・異常系のテストを追加しました。
    • 異常系のテストは、math.pyを対象として行っています。

Comment thread atcoder/math.py


def floor_sum(n: int, m: int, a: int, b: int) -> int:
assert 1 <= n

@KATO-Hiro KATO-Hiro Sep 23, 2020

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

公式リポジトリのドキュメントを読み、n, mに関する制約条件の判定が抜けているように思いましたので、assertを追加しました(公式リポジトリも同様)。公式リポジトリで制約条件の緩和が検討されており、この対応を受けて修正するのがよさそうでしょうか?

また、本PRで述べるか迷いましたが、公式ドキュメントの式・制約条件から、nの下限値が0ではなく1であるように思います。いかがお考えでしょうか?(私の理解不足・誤解の可能性が高いと思いますが・・・)。ACL Practice ContestのC問題の制約条件では、nの下限値が1となっており、判断に迷っています。

@KATO-Hiro

Copy link
Copy Markdown
Contributor Author

WHAT

型チェックを追加いたしました。
レビューをお願いしてもよろしいでしょうか?

@not522

not522 commented Dec 12, 2020

Copy link
Copy Markdown
Owner

遅くなってすいません。マージします。

@not522 not522 merged commit e02633e into not522:master Dec 12, 2020
@KATO-Hiro

Copy link
Copy Markdown
Contributor Author

レビューとマージをしていただきありがとうございます。

@KATO-Hiro KATO-Hiro deleted the features/test_math branch December 12, 2020 04:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants